package com.twq.patternmatch.patternusages

/**
 * Created by tangweiqun on 2017/12/9.
 */
object For {
  def main(args: Array[String]): Unit = {
    //pattern在for表达式中
    val results = List(Some("apple"), None, Some("orange"))
    for (Some(fruit) <- results) println(fruit)

    val capitals =
      Map("France" -> "Paris", "Japan" -> "Tokyo")
    for ((country, city) <- capitals)
      println("The capital of " + country + " is " + city)
  }
}
